package ioc17;




import java.beans.PropertyEditorSupport;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class DataEditor extends PropertyEditorSupport {

    private String format;


    @Override
    public void setAsText(String text) throws IllegalArgumentException {

        try {
            DateFormat dateFormat=new SimpleDateFormat(format);

            setValue(dateFormat.parse(text));
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }
}
